import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:get/get.dart';

class Creator extends StatelessWidget {
  Creator({Key? key}) : super(key: key);
  final String url = 'http://test.fishing.xq5.com/road_edit/web-mobile/';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Theme.of(context).colorScheme.background,
        body: Center(child: LayoutBuilder(builder: (context, constraints) {
          return Container(
              constraints: const BoxConstraints(
                maxWidth: 800,
                minWidth: 550,
              ),
              child: Scaffold(
                appBar: AppBar(
                  title: const Text('My Cocos'),
                  leading: IconButton(
                    icon: Icon(Icons.arrow_back),
                    onPressed: () => Get.back(result: {'success': url}),
                  ),
                  backgroundColor: Color.fromRGBO(154, 223, 217, 0.961),
                ),
                body: Center(
                    child: InAppWebView(
                  initialUrlRequest: URLRequest(
                    url: Uri.parse(url),
                  ),
                  initialOptions: InAppWebViewGroupOptions(
                      crossPlatform: InAppWebViewOptions(
                        preferredContentMode: UserPreferredContentMode.DESKTOP,
                        transparentBackground: false,
                        javaScriptEnabled: true,
                      ),
                      android: AndroidInAppWebViewOptions(
                        useHybridComposition: true,
                        cacheMode: AndroidCacheMode.LOAD_CACHE_ELSE_NETWORK,
                      )),
                )),
              ));
        })));
    // Column(
    //   children: [ElevatedButton(
    //     child: Text('open view'),
    //     onPressed: () {
    //       InAppWebView(
    //         initialUrlRequest: URLRequest(
    //           url: Uri.parse(url),
    //         ),
    //         initialOptions: InAppWebViewGroupOptions(
    //           crossPlatform: InAppWebViewOptions(
    //             preferredContentMode: UserPreferredContentMode.DESKTOP,
    //             transparentBackground: false,
    //             javaScriptEnabled: true,
    //           ),
    //           android: AndroidInAppWebViewOptions(
    //             useHybridComposition: true,
    //             cacheMode:  AndroidCacheMode.LOAD_CACHE_ELSE_NETWORK,
    //           )
    //         ),
    //       );
    //     }
    //   ),]
    // )
  }
}
